<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <input type="text" id="inp" value="2">
    <div id="b"></div>
</body>

</html>
<script>
    // var o = {}
    // Object.defineProperty(o,"a",{
    //     value:37
    // })
    // var bValue = document.querySelector("#inp").value
    // Object.defineProperty(o,"b",{
    //     get:function(){
    //         return bValue
    //     },
    //     set:function(newValue){
    //         bValue = newValue;
    //     }
    // })
    // console.log(o.b)
    var obj = {};
    Object.defineProperty(obj, 'a', {
        set: function (newVal) {
            document.getElementById('a').value = newVal;
            document.getElementById('b').innerHTML = newVal;
        }
    });
    document.addEventListener('keyup', function (e) {
        obj.a = e.target.value;
    });
    // http://imweb.io/topic/56d40adc0848801a4ba198ce
</script>